import { Devcloud } from "../apiClass"
import { IResult } from "../../plugins/Interfaces"



export interface ProjectListPageVoQueryType{
  productId?: number,
  envId: number,
  projectId?: number,
  moduleId?: number,
  projectName?: string,
  moduleName?: string
}

export class ProjectApi extends Devcloud {
  private baseUrl: string = this.path + 'project/';
  async projectListPageVo(data:ProjectListPageVoQueryType):Promise<IResult> {
      const resp = await this.client.post(this.baseUrl + "projectListPageVo", data)
      return resp.data
  }
  async projectListPageVoByModuleId(moduleId:number):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "projectListPageVoByModuleId", {moduleId:moduleId})
      return resp.data
  }
  async insert(param:any):Promise<IResult> {
      const resp = await this.client.post(this.baseUrl + "insert", param)
      return resp.data
  }
  async delete(id:string):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "delete", {id: id})
      return resp.data
  }
  async getByModuleId(moduleId:number):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "getByModuleId", {moduleId:moduleId})
      return resp.data
  }
  async copyEnableEnv(projectName:string):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "copyEnableEnv", {projectName:projectName})
      return resp.data
  }
  async copy(param:any):Promise<IResult> {
      const resp = await this.client.get(this.baseUrl + "copy", param)
      return resp.data
  }
  async listProductProjectTree(param: any): Promise<IResult> {
    const resp = await this.client.post(this.baseUrl + "listProductProjectTree", param)
    return resp.data
  }
}